package com.hunttown.mes.manage.service;

import com.hunttown.mes.rpc.domain.TransportExpenseDetailDTO;
import com.hunttown.common.domain.Page;
import com.hunttown.mes.rpc.api.TransportExpenseDetailRpcService;
import com.hunttown.mes.rpc.domain.query.TransportExpenseDetailDTOQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * created by wangjunfu on 2019-07-07 10:50:30
 */
@Service
public class TransportExpenseDetailManageService {

    private final static Logger logger = LoggerFactory.getLogger(TransportExpenseDetailManageService.class);

    private final TransportExpenseDetailRpcService rpcService;

    @Autowired
    public TransportExpenseDetailManageService(TransportExpenseDetailRpcService rpcService) {
        this.rpcService = rpcService;
    }

    // 新增
    public TransportExpenseDetailDTO insert(TransportExpenseDetailDTO objDTO) {
        return rpcService.insert(objDTO);
    }

    // 批量插入
    public List<TransportExpenseDetailDTO> insertForBatch(List<TransportExpenseDetailDTO> batchList) {
        return rpcService.insertForBatch(batchList);
    }

    // 通过ID修改
    public Boolean updateInfoById(TransportExpenseDetailDTO objDTO) {
        return rpcService.updateInfoById(objDTO);
    }

    // 通过Query修改
    public Boolean updateInfoByQuery(TransportExpenseDetailDTOQuery objDTOQuery) {
        return rpcService.updateInfoByQuery(objDTOQuery);
    }

    // 通过ID删除
    public Boolean delete(Integer id) {
        return rpcService.deleteById(id);
    }

    // 通过ID获取
    public TransportExpenseDetailDTO getById(Integer id) {
        if (id <= 0) {
            return null;
        }
        return rpcService.selectById(id);
    }

    // 通过Query获取
    public TransportExpenseDetailDTO getByQuery(TransportExpenseDetailDTOQuery objDTOQuery) {
        return rpcService.selectObjByQuery(objDTOQuery);
    }

    // 获取分页列表
    public Page<TransportExpenseDetailDTO> getForPage(TransportExpenseDetailDTOQuery objDTOQuery) {
        return rpcService.getListForPage(objDTOQuery);
    }
}